﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Easyui扩展库 Tabs - 落阳 整理</title>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery/jquery-1.11.0.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>

    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/tabs/jeasyui.extensions.tabs.getTabs.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/tabs/jeasyui.extensions.tabs.closeTabs.js"></script>
    <script>
        $(function () {
            
            $("a[id^='btnGetLefts']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeLeft", "标签页" + order);
            });

            $("a[id^='btnGetRights']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeRight", "标签页" + order);
            });

            $("a[id^='btnGetOthers']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeOther", "标签页" + order);
            });

            $("#btnGetClosables").click(function () {
                var theTabs = $("#tabs1").tabs("closableTabs");
                if (theTabs.length) {
                    alert("共获取到可关闭标签页[" + theTabs.length + "]个，分别是：" + ($.array.map(theTabs, function (item) { return item.panel("options").title; }).join("，")));
                } else {
                    alert("未获取到可关闭标签页");
                }
            });

            $("a[id^='btnGetClosableLefts']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeLeftClosable", "标签页" + order);
            });

            $("a[id^='btnGetClosableRights']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeRightClosable", "标签页" + order);
            });

            $("a[id^='btnGetClosableOthers']").click(function () {
                var id = $(this).attr("id"), order = id.split("_")[1];
                $("#tabs1").tabs("closeOtherClosable", "标签页" + order);
            });
        });
    </script>
</head>
<body>
    <div id="tabs1" class="easyui-tabs" data-options="fit:true,border:false">
        <div data-options="title:'标签页1',closable:true" style="padding:15px;">
            标签页1
            <br />
            <div style="color:red;">关闭按钮在“标签页5”中。</div>
            <br /><br />
            <a id="btnGetClosables" class="easyui-linkbutton" data-options="iconCls:'icon-save'">获取所有可关闭标签页</a>
        </div>
        <div data-options="title:'标签页2',closable:true" style="padding:15px;">
            标签页2
        </div>
        <div data-options="title:'标签页3',selected:true" style="padding:15px;">
            标签页3
        </div>
        <div data-options="title:'标签页4'" style="padding:15px;">
            标签页4
        </div>
        <div data-options="title:'标签页5',closable:true" style="padding:15px;">
            标签页5
            <br />
            <a id="btnGetClosableLefts_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页左边的所有可关闭标签页</a>
            <br /><br />
            <a id="btnGetClosableRights_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页右边的所有可关闭标签页</a>
            <br /><br />
            <a id="btnGetClosableOthers_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页之外的所有可关闭标签页</a>
            <br /><br /><br /><br />
            <a id="btnGetLefts_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页左边的所有标签页</a>
            <br /><br />
            <a id="btnGetRights_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页右边的所有标签页</a>
            <br /><br />
            <a id="btnGetOthers_5" class="easyui-linkbutton" data-options="iconCls:'icon-add'">关闭当前标签页之外的所有标签页</a>
        </div>
        <div data-options="title:'标签页6'" style="padding:15px;">
            标签页6
        </div>
        <div data-options="title:'标签页7',closable:true" style="padding:15px;">
            标签页7
        </div>
        <div data-options="title:'标签页8',closable:true" style="padding:15px;">
            标签页8
        </div>
    </div>
</body>
</html>
